<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>小米官网样式</title>
    <link rel="stylesheet" href="./normalize.css" />
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .nav {
        width: 300px;
        height: 100vh;
        margin: 0;
        padding: 0;
        background-color: rgba(0, 0, 0, 0.6);
      }
      .nav > li {
        position: relative;
        display: flex;
        align-items: center;
        height: 40px;
        padding: 0 8px;
      }
      .nav > li:hover {
        background-color: aqua;
      }
      .nav > li:hover ul {
        display: grid;
      }
      .nav > li > ul {
        display: none;
        position: absolute;
        top: 0;
        left: 100%;
        height: 480px;
        grid-template-columns: 300px;
        grid-auto-columns: 300px;
        grid-template-rows: repeat(6, 1fr);
        /* 设置默认换行是从列开始 */
        display: none;
        grid-auto-flow: column;
       
      }
      .nav > li > ul > li {
        background-color: brown;
      }
      .nav > li > ul > li:hover {
        background-color: blueviolet;
      }
    </style>
  </head>
  <body>
    <ul class="nav">
      <li>
        <span>菜单</span>
        <ul>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
          <li>
            <span>子菜单</span>
          </li>
        </ul>
      </li>
      <li><span>菜单</span></li>
      <li><span>菜单</span></li>
      <li><span>菜单</span></li>
      <li><span>菜单</span></li>
      <li><span>菜单</span></li>
    </ul>
  </body>
</html>
